/*
* FileName MoonSurface.cpp
*/

#include "stdafx.h"
#include "MoonSurface.h"

namespace DeepZoomImage
{

	MoonSurface::MoonSurface ()
	{
		m_refcount = 1;
	}

	MoonSurface::~MoonSurface ()
	{
	}

	MoonSurface* MoonSurface::ref ()
	{
		//InterlockedExchangeAdd (&m_refcount, 1);
		m_refcount++;

		return this;
	}

	void MoonSurface::unref ()
	{
		int v=0;

		//v = InterlockedExchangeAdd (&m_refcount, -1) - 1;
		//if (v == 0)
		//	delete this;

		m_refcount--;
		if ( m_refcount == 0 ) {
			delete this;
		}
	}

	cairo_surface_t* MoonSurface::Cairo()
	{
		//g_warning ("MoonSurface::Cairo has been called. The derived class should have overridden it.");

		return NULL;
	}
}